feat(mgc): add semantic search for Magalu docs#21
Conversation
- Add DocsIndex with TF-IDF based semantic search - Add search_magalu_docs and get_magalu_doc tools - Add scrape-docs script using docusaurus-to-md - Configurable via MAGALU_DOCS_DIR env var
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds documentation search functionality to the MCP server by introducing a new Changes
Sequence DiagramsequenceDiagram
participant Client
participant MgcMCPServer as MCP Server
participant MgcTools
participant DocsIndex
participant FileSystem as File<br/>System
Client->>MgcMCPServer: Call search_magalu_docs<br/>(query, max_results)
MgcMCPServer->>MgcMCPServer: Validate params<br/>via schema
MgcMCPServer->>MgcTools: searchDocs(validated)
MgcTools->>DocsIndex: load() [idempotent]
DocsIndex->>FileSystem: Discover .md files<br/>in docsDir
FileSystem-->>DocsIndex: File list
DocsIndex->>FileSystem: Read markdown<br/>content & manifest
FileSystem-->>DocsIndex: Content & metadata
DocsIndex->>DocsIndex: Extract titles,<br/>tokenize, compute IDF
DocsIndex-->>MgcTools: Index loaded
MgcTools->>DocsIndex: search(query,<br/>maxResults)
DocsIndex->>DocsIndex: TF/IDF score<br/>& rank results
DocsIndex-->>MgcTools: Ranked results<br/>w/ snippets
MgcTools-->>MgcMCPServer: McpToolResult<br/>(results, metadata)
MgcMCPServer-->>Client: Search results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Descricao
Adiciona busca semântica na documentação da Magalu Cloud dentro do MCP
mgcexistente. Usa TF-IDF para indexar markdowns scraped viadocusaurus-to-mde expõe duas novas tools:search_magalu_docseget_magalu_doc.Etiquetas (Labels)
Historia Relacionada
N/A
Motivacao e Contexto
Precisamos de uma forma de consultar a documentação da Magalu Cloud diretamente via MCP, permitindo que agentes encontrem informações relevantes sem sair do fluxo de trabalho. A busca semântica com TF-IDF é leve, local e não depende de APIs externas de embeddings.
Como Isso Foi Testado?
Analise de Risco e Impacto
Capturas de Tela ou Auxilios Visuais (se apropriado)
N/A
Summary by CodeRabbit
Release Notes
New Features
search_magalu_docstool to find relevant documentation andget_magalu_doctool to retrieve full document contentMAGALU_DOCS_DIRenvironment variable to enable local docs searchingDocumentation
Chores